<div class="pagination">
    <span class="total">共{{page.totalRecords}}条</span>
    <!--<a class="pre-btn">上一页</a>-->
    {% set total_group = (( page.pageCount / 5 ) | round(0, "ceil") ) %}
    {% set current_group = ( ( pageNo / 5 ) | round(0, "ceil")) %}
    {% if current_group != total_group %}
        {% set group_total = 5 %}
    {% else %}
        {% set group_total = page.pageCount - (current_group - 1) * 5 %}
    {% endif %}

    {{ page.pageCount }}
    {{ total_group }}
    {{ current_group }}
    {{ group_total }}
    
    
    {% if current_group != 1 %}
        <a href="{{base_url + '?pageNo=' +  ((current_group - 2) * 5 + 1)  }}"  class="next-btn">上一页</a>

        {% if pageNo > 1 %}
            <a href="{{base_url + '?pageNo=' + (pageNo - 1)}}" class="no-pre"></a>
        {% else %}
            <span class="no-pre"></span>   
        {% endif %}

        <a href="{{base_url + '?pageNo=1'}}" class="page-btn">1</a>
        <span class="dots">...</span>
    {% else %}
        {% if pageNo > 1 %}
            <a href="{{base_url + '?pageNo=' + (pageNo - 1)}}" class="no-pre"></a>
        {% else %}
            <span class="no-pre"></span>   
        {% endif %}
    {% endif %}
    {% for i in range(1, group_total + 1) %}
        {% if (current_group - 1) * 5 + i == pageNo %}
            <span class="page-btn active">{{(current_group - 1) * 5 + i}}</span>
        {% else %}
            <a href="{{base_url + '?pageNo=' + ((current_group - 1) * 5 + i)}}" class="page-btn">{{(current_group - 1) * 5 + i}}</a>
        {% endif %}
    {% endfor %}

    {% if current_group != total_group %}
        <span class="dots">...</span>
        <a href="{{base_url + '?pageNo=' + page.pageCount}}" class="page-btn">{{page.pageCount}}</a>

        {% if pageNo != page.pageCount %}
            <a href="{{base_url + '?pageNo=' + (pageNo + 1)}}" class="no-next"></a>
        {% else %}
            <span class="no-next"></span>
        {% endif %}

        <a href="{{base_url + '?pageNo=' +  (current_group * 5 + 1)  }}"  class="next-btn">下一页</a>
    {% else %}
        {% if pageNo != page.pageCount %}
            <a href="{{base_url + '?pageNo=' + (pageNo + 1)}}" class="no-next"></a>
        {% else %}
            <span class="no-next"></span>
        {% endif %}
    {% endif %}
</div>